import { domain } from './config.js';
let getData = (url,data,method)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			url:domain + url,
			data:data,
			method:method,
			header: {
				token:uni.getStorageSync('uToken')?uni.getStorageSync('uToken'):'',
				'Content-Type': 'application/x-www-form-urlencoded',
			},
			success: (res) => {
				// console.log('请求地址：'+url);
				// console.log('请求结果：');
				// console.log(res);
				if(res.data.code == 1){
					resolve(res.data.data ? res.data.data : true);
				}else{
					uni.showToast({
						title:res.data.msg,
						icon:"none"
					})
					resolve(false);
				}
			},
			fail:(err)=>{
				// uni.hideLoading();
				console.log(err);
			}
		})
	})
}
export {getData};